
package com.rt.schedulenew.web;

import com.rt.schedulebase.mapper.DictScheduleApmMapper;
import com.rt.schedulenew.api.*;
import com.rt.schedulenew.utils.checkparam.config.Check;
import com.rt.schedulenew.utils.global.JsonResult;
import com.rt.schedulenew.dto.DictScheduleApmDutyDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping({"/duty"})
public class DutyController {
    @Autowired
    ISourceService sourceService;
    @Autowired
    IDictExamQueueService dictExamQueueService;
    @Autowired
    IDictScheduleApmService dictScheduleApmService;
    @Autowired
    IDeptDutyService deptDutyService;
    @Autowired
    DictScheduleApmMapper dictScheduleApmMapper;
    @Autowired
    IDictScheduleApmDutyService dictScheduleApmDutyService;

    /**
     * 获取人员排班信息
     * @param dto
     * @return
     */
    @PostMapping({"/list"})
    @Check({"startDate", "endDate"})
    public JsonResult dutyList(@RequestBody DictScheduleApmDutyDto dto) {
        return this.deptDutyService.getDutyList(dto);
    }

    @PostMapping({"/insert"})
    public JsonResult dutyInsert(@RequestBody DictScheduleApmDutyDto dto) {
        return this.deptDutyService.insertDuty(dto);
    }

    @PostMapping({"/delete"})
    @Check({"apmCode", "scheduleDate"})
    public JsonResult dutyDelete(@RequestBody DictScheduleApmDutyDto dto) {
        return this.deptDutyService.dutyDelete(dto);
    }

    /**
     * 赋值人员排班
     * @param dto
     * @return
     */
    @PostMapping({"/copy"})
    @Check({"examClass", "startDate", "endDate", "dutyDate"})
    public JsonResult dutyCopy(@RequestBody DictScheduleApmDutyDto dto) {
        return this.dictScheduleApmDutyService.copyDuty(dto);
    }
}
